//
//  rongzilistViewController.m
//  hainingOASystem
//
//  Created by michael on 2017/12/1.
//  Copyright © 2017年 czd. All rights reserved.
//
#import "rzlistTableViewCell.h"
#import "rongzilistViewController.h"
#import "rongzixqViewController.h"
@interface rongzilistViewController ()

@end

@implementation rongzilistViewController

- (void)viewDidLoad {
    [super viewDidLoad];
              NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:

[UIColor whiteColor],NSForegroundColorAttributeName, nil];
 
[self.navigationController.navigationBar setTitleTextAttributes:attributes];
 self.navigationController.navigationBar.barTintColor = [UIColor blueColor];
     self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
        self.title = @"申请融资";
self.view.backgroundColor = [UIColor whiteColor];
            _tableView = [[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    _tableView.dataSource = self;
_tableView.delegate = self;
[self.view addSubview:_tableView];
     [self loaddata];

    // Do any additional setup after loading the view.
}
- (void)loaddata{
 [MBProgressHUD showHUDAddedTo:self.view animated:YES];

        NSString *name = [[NSUserDefaults standardUserDefaults] objectForKey:@"userId"];
                NSString *password = [[NSUserDefaults standardUserDefaults] objectForKey:@"password"];


NSString *string = [[NSString alloc]initWithFormat:@"%@%@&password=%@",krzlist,name,password];
[httpTool ZBPostNetDataWith:string withDic:nil andSuccess:^(NSDictionary* dictionary){
 [MBProgressHUD hideHUDForView:self.view animated:YES];

NSLog(@"%@",dictionary);
_dataArray = dictionary[@"finaceList"];
[_tableView reloadData];

 }andFailure:^{
            [self.view makeToast:@"服务器错误!"];

 }];

}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.dataArray.count;
}
 -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

 
    return  230;

}
#pragma mark UITableView dataScource
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

  static NSString *CellIdentifier = @"Cellrzlist";

    rzlistTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell==nil) {
        cell=[[rzlistTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
    
 NSDictionary *dic = self.dataArray[indexPath.row];
    cell.dic = dic;
    return cell;



 }
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
 NSDictionary  *dic = _dataArray[indexPath.row];
    NSLog(@"%zd",indexPath.item);
    rongzixqViewController *vc = [[rongzixqViewController alloc]init];
    vc.id = dic[@"id"];
    [self.navigationController pushViewController:vc animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
